package com.sugon.service.impl;

import cn.hutool.core.util.RandomUtil;
import com.sugon.dao.DevLineDevCoordinateDao;
import com.sugon.entity.DevLineDevCoordinateEntity;
import com.sugon.modules.analyse.model.vo.DevCoordinateVO;
import com.sugon.service.DevLineDevCoordinateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 产线中设备坐标信息Service实现类
 *
 * @author YuXD
 * @date 2020-05-25 16:06:02
 */
@Service("devLineDevCoordinateService")
public class DevLineDevCoordinateServiceImpl implements DevLineDevCoordinateService {
    /**
     *
     */
    @Autowired
    private DevLineDevCoordinateDao devLineDevCoordinateDao;

    /**
     * getLineDevCoorSetting
     *
     * @param lineCode 产线CODE
     * @return
     */
    @Override
    public List<DevCoordinateVO> getLineDevCoorSetting(String lineCode) {
        List<DevCoordinateVO> devCoordinates = devLineDevCoordinateDao.getLineDevCoorSetting(lineCode);
        return devCoordinates == null ? new ArrayList<>() : devCoordinates;
    }

    /**
     * getByCode
     *
     * @param code
     * @return
     */
    @Override
    public DevLineDevCoordinateEntity getByCode(String code) {
        return devLineDevCoordinateDao.getByCode(code);
    }

    /**
     * queryObject
     *
     * @param id 主键
     * @return
     */
    @Override
    public DevLineDevCoordinateEntity queryObject(String id) {
        return devLineDevCoordinateDao.queryObject(id);
    }

    /**
     * queryList
     *
     * @param map 参数
     * @return
     */
    @Override
    public List<DevLineDevCoordinateEntity> queryList(Map<String, Object> map) {
        return devLineDevCoordinateDao.queryList(map);
    }

    /**
     * queryTotal
     *
     * @param map 参数
     * @return
     */
    @Override
    public int queryTotal(Map<String, Object> map) {
        return devLineDevCoordinateDao.queryTotal(map);
    }

    /**
     * save
     *
     * @param devLineDevCoordinate 实体
     * @return
     */
    @Override
    public int save(DevLineDevCoordinateEntity devLineDevCoordinate) {
        devLineDevCoordinate.setId(RandomUtil.randomString(32));
        return devLineDevCoordinateDao.save(devLineDevCoordinate);
    }

    /**
     * update
     *
     * @param devLineDevCoordinate 实体
     * @return
     */
    @Override
    public int update(DevLineDevCoordinateEntity devLineDevCoordinate) {
        return devLineDevCoordinateDao.update(devLineDevCoordinate);
    }

    /**
     * delete
     *
     * @param id
     * @return
     */
    @Override
    public int delete(String id) {
        return devLineDevCoordinateDao.delete(id);
    }

    /**
     * deleteBatch
     *
     * @param ids
     * @return
     */
    @Override
    public int deleteBatch(String[] ids) {
        return devLineDevCoordinateDao.deleteBatch(ids);
    }
}
